import requests
import random

def get_admin_token():
    url = 'http://hn216.api.yesapi.cn/'
    payload = {
        "s" : "App.User.LoginExt",
        "app_key":"40EF74B20D894D3F9EBBC3C8D3F5B773",
        "username":"liuhaitao",
        "password":"1234567"
    }
    r = requests.post(url,json=payload)
    return r.json().get('data').get('token')

def get_register_uuid():
    url = 'http://hn216.api.yesapi.cn/'
    payload = {
        "s" : "App.User.RegisterExt",
        "app_key":"40EF74B20D894D3F9EBBC3C8D3F5B773",
        "username":"liuhaitao"+str(random.randint(1000,9999)),
        "password":"123456"
    }
    r = requests.post(url,json=payload)
    return r.json().get('data').get('uuid')

def set_res_data(s):
    return s.replace('":','=').replace('="','=')
